package com.bestcem.xm.member.entity.pojo;

import com.bestcem.xm.member.entity.mysql.GroupEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.Date;

/**
 * 示例服务
 *
 * @author yf.wang <yf.wang@idiaoyan.com>
 * @version V1.0
 * @date 2021/12/24
 */
@Getter
@Setter
@ToString
public class GroupDO {

    private String id;

    /**
     * 企业标识
     */
    private String orgId;

    /**
     * 分组名称
     */
    private String name;

    /**
     * 分组条件
     */
    private String condition;

    /**
     * 是否自动更新,true为自动更新
     */
    private Integer auto;

    /**
     * 分组同步令牌
     */
    private String syncToken;

    /**
     * 分组自增seq
     */
    private Long seq;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 是否样例数据 0 否 1 是
     */
    private Integer isSample;


    public static GroupEntity toEntity(GroupDO group) {
        GroupEntity entity = new GroupEntity();
        entity.setAuto(group.getAuto());
        entity.setCondition(group.getCondition());
        entity.setCreateTime(group.getCreateTime());
        entity.setId(group.getId());
        entity.setName(group.getName());
        entity.setOrgId(group.getOrgId());
        entity.setSeq(group.getSeq());
        entity.setSyncToken(group.getSyncToken());
        entity.setUpdateTime(group.getUpdateTime());
        entity.setIsSample(group.getIsSample());
        return entity;
    }

    public static GroupDO toDO(GroupEntity group) {
        GroupDO entity = new GroupDO();
        entity.setAuto(group.getAuto());
        entity.setCondition(group.getCondition());
        entity.setCreateTime(group.getCreateTime());
        entity.setId(group.getId());
        entity.setName(group.getName());
        entity.setOrgId(group.getOrgId());
        entity.setSeq(group.getSeq());
        entity.setSyncToken(group.getSyncToken());
        entity.setUpdateTime(group.getUpdateTime());
        entity.setIsSample(group.getIsSample());
        return entity;
    }
}
